package me.fanwu.controllers;

import spark.ModelAndView;
import spark.Request;
import spark.Response;
import spark.Route;
import spark.template.mustache.MustacheTemplateEngine;

import java.util.HashMap;
import java.util.Map;

/*
 * Wupher 编写于 2016/11/4.
 */
public class AlipayController {

    public static final MustacheTemplateEngine engine = new MustacheTemplateEngine();

    public static Route serverCallBack = (Request request, Response response) ->{
        Map<String, Object> model = new HashMap<>();
        String appID = request.queryParams("app_id");
        String token = request.queryParams("app_auth_code");
        model.put("appID", appID);
        model.put("appAuthToken", token);

        return engine.render(new ModelAndView(model, "callback.html"));
    };
}
